// Domien Nowicki
#include "QtAnimationLog.h"

QtAnimationLog::QtAnimationLog()
{
}

QtAnimationLog::~QtAnimationLog()
{
	std::list<QtAnimationCommand*>::iterator it;

	for(it = commands.begin(); it != commands.end(); ++it)
	{
		delete (*it);
	}

	commands.clear();
}

void QtAnimationLog::AddAnimationCommand(QtAnimationCommand* command)
{
	commandGroup.AddCommand(command->Clone());
}

bool QtAnimationLog::Empty() const
{
	return commands.size() == 0;
}

void QtAnimationLog::Execute()
{
	if (!Empty())
	{
		QtAnimationCommand *front = commands.front();

		front->Execute();
	}
}

void QtAnimationLog::DropFront()
{
	if (!Empty())
	{
		QtAnimationCommand *front = commands.front();
		delete front;

		commands.pop_front();
	}
}

void QtAnimationLog::BeginCommandGroup()
{
	commandGroup.Clear();
}

void QtAnimationLog::EndCommandGroup()
{
	if (!commandGroup.Empty())
		commands.push_back( commandGroup.Clone() );
}

